from src.util import import_file
from src.util import transform
from src.util import paint
from numpy import *
import matplotlib.pyplot as plt

path = 'I:\\pyCharmProjectSet\\ToolSet\\data\\rubic\\segcna.tsv'
#实例化对象
im = import_file.ImportFile()
tr = transform.Transform()
#取出探针数和拷贝数值
probes_all_samples = im.import_column_in_csv(path,4)
probes_all_samples = tr.list_string_to_int(probes_all_samples)
log_ratio_all_samples = im.import_column_in_csv(path,5)
log_ratio_all_samples = tr.list_string_to_float(log_ratio_all_samples)

# 将读取的值弄成可读的点，便于画图
segments_number = len(probes_all_samples)  #分段总数（包含所有样本）
samples_number = 60  #样本总数
markers_number_per_sample = 500
x=[]  #所有样本的横坐标对应点（位点）
x.append([])
y=[]  #所有样本的纵坐标对应点（拷贝数值）
y.append([])
sum=0  #第几个位点
sample=0 #第几个sample
for i in range(segments_number):
    for j in range(probes_all_samples[i]):
        sum+=1
        x[sample].append(sum)
        y[sample].append(log_ratio_all_samples[i])
        if sum == markers_number_per_sample and len(x)<samples_number:
            sum = 0
            x.append([])
            y.append([])
            sample+=1

#画图

drivers_region = [[30, 70], [280, 320]]; #驱动区间
#实例化对象
pa = paint.Paint()
pa.paint_scatter_diagram(16,32,x,y,drivers_region)
